/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package minValue;

/**
 *
 * @author mj
 */
class Triplex {

    private final Point p11;
    private final Point p22;
    private final Point p33;

    Triplex(Point p1, Point p2, Point p3) {
        p11 = p1;
        p22 = p2;
        p33 = p3;
    }

    double aer() {
        double p = (ptop(p11, p22) + ptop(p11, p33) + ptop(p22, p33))/2 ;
        double m2 = p * (p - ptop(p11, p22)) * (p - ptop(p11, p33)) * (p - ptop(p22, p33));
        return Math.sqrt(m2);
    }

    private double ptop(Point p11, Point p22) {
        return Math.sqrt((p11.getX() - p22.getX()) * (p11.getX() - p22.getX()) + (p11.getY() - p22.getY()) * (p11.getY() - p22.getY()));
    }
}
